<?php
	include('includes/db.php');
	include('includes/config.php');
	include('includes/head.php');
	include('includes/nav.php');
	if (isset($_COOKIE["user"]))
	{
		$usr= $_COOKIE["user"];
		$query = "UPDATE `users` SET `online`=0 WHERE `username`='$usr'";
		$result = mysql_query($query);
		setcookie("user", "", time()-3600);
		setcookie("pass", "", time()+3600);
		echo "You have been logged out. You will be forwared it the home page shortly.";
		header("Location: $site_url");
	}
	else
	{
		echo "You were never logged in. You will be forwared it the home page shortly";
		header("Location: $site_url");
	}
	include('includes/foot.php');
?>
